/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-05-27
 * Time: 23:17
 */
public class Test11 {
    public static void main(String[] args) {
        String str1 = "hello1 new1 classmates1";

        String[] result1 = str1.split(" ") ; // 按照空格拆分

        for(String x: result1) {
            System.out.println(x);
        }
        System.out.println("-------------------------------------------------");
        String str2 = "hello2 new2 classmates2";
        String[] result2 = str2.split(" ",2) ; // 按照空格拆分,成两组

        for(String x: result2) {
            System.out.println(x);
        }
    }
}
